//
//  MqForumDetailSettingsViewController.m
//  Meiqi
//
//  Created by lanou on 16/1/13.
//  Copyright © 2016年 KFC. All rights reserved.
//

#import "MqForumDetailSettingsViewController.h"
#import "MqForumSettingsNotificationCell.h"
#import "MqForumOnlySeeCell.h"
#import "MqForumSettingsCheckCell.h"
#import "MqForumFontSizeCell.h"
@interface MqForumDetailSettingsViewController ()
<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation MqForumDetailSettingsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:(UITableViewStyleGrouped)];
    
    //  设置代理
    _tableView.delegate = self;
    _tableView.dataSource = self;
    
    [self.view addSubview:_tableView];
    
    //  注册cell
    [_tableView registerClass:[MqForumSettingsNotificationCell class] forCellReuseIdentifier:@"MqForumSettingsNotificationCell"];
    
    [_tableView registerClass:[MqForumOnlySeeCell class] forCellReuseIdentifier:@"MqForumOnlySeeCell"];
    
    [_tableView registerClass:[MqForumSettingsCheckCell class] forCellReuseIdentifier:@"MqForumSettingsCheckCell"];
    
    [_tableView registerClass:[MqForumFontSizeCell class] forCellReuseIdentifier:@"MqForumFontSizeCell"];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 4;
    
}

//  返回分区个数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    if (section == 0 || section == 3) {
        
        return 1;
        
    }
    
    return 2;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.section) {
        case  0:
        {
            MqForumSettingsNotificationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumSettingsNotificationCell" forIndexPath:indexPath];
            
            return cell;
        }
        break;
            
        case 1:
        {
            if (indexPath.row == 0) {
                
                MqForumOnlySeeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumOnlySeeCell" forIndexPath:indexPath];
                
                return cell;
                
            }else{
                
                MqForumSettingsCheckCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumSettingsCheckCell" forIndexPath:indexPath];
                
                return cell;
                
            }
        }
        
        case 2:
        {
            
            if (indexPath.row == 0) {
                MqForumOnlySeeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumOnlySeeCell" forIndexPath:indexPath];
                
                cell.titleLabel.text = @"显示图片";
                
                return cell;
                
            }else{
                
                MqForumFontSizeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumFontSizeCell" forIndexPath:indexPath];
                
                
                return cell;
                
            }
            
        }
            
        case 3:
        {
            
            MqForumOnlySeeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumOnlySeeCell" forIndexPath:indexPath];
            
            cell.titleLabel.text = @"举报";
            cell.cellSwitch.hidden = YES;
            
            return cell;
            
        }
            
        default:
            break;
    }
    
    
    MqForumOnlySeeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MqForumOnlySeeCell" forIndexPath:indexPath];
    
    cell.titleLabel.text = @"只看楼主";
    
    return cell;
    

   
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
